

import java.util.List;

public class StringUtils {
	public static String convertArr2String(String[] arr) {
		if(arr == null || arr.length == 0) {
			return "";
		}
		StringBuffer sb = new StringBuffer();
		for(String s : arr) {
			sb.append(s).append(",");
		}
		sb.deleteCharAt(sb.length() - 1);
		return sb.toString();
	}
	
	public static String convertArr2In(List<String> companyNames) {
		if(companyNames.size() == 0) {
			return null;
		}
		StringBuffer sb = new StringBuffer();
		for(String s : companyNames) {
			sb.append("'" + s + "',");
		}
		sb.deleteCharAt(sb.length()-1);	// 删除最后的逗号
		return sb.toString();
	}
	
	public static String convertArr2In(String[] companyNames) {
		StringBuffer sb = new StringBuffer();
		for(String s : companyNames) {
			sb.append("'" + s + "',");
		}
		sb.deleteCharAt(sb.length()-1);	// 删除最后的逗号
		return sb.toString();
	}
	public static boolean isEmpty(String str) {
		return str == null || "".equals(str) || "".equals(str.trim());
	}
}
